{% extends 'basic_app/master.html' %}
{% block tag_left %}
    {% include 'basic_app/tag_left_user.html' %}
{% endblock %}
{% block userinfo %}
    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        <h1 class="page-header">APP</h1>
        <div class="row placeholders">
            <div class="col-xs-6 col-sm-3 placeholder">
                <a href="/oratk_app/oratk_use"> <img src="/static/img/database2.jpg" width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail"> </a>
                <a href="/oratk_app/oratk_use"> <h4>oratk</h4> </a>
                <span class="text-muted"> ora运维工具 </span>
            </div>
            <div class="col-xs-6 col-sm-3 placeholder">
                <a href="/oratk_app/oratk"> <img src="/static/img/zabbix2.png" width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail"> </a>
                <a href="/oratk_app/oratk"> <h4>zabbix</h4> </a>
                <span class="text-muted">数据库 监控平台</span>
            </div>
            <div class="col-xs-6 col-sm-3 placeholder">
                <a href="链接bai的地址du"> <img src="/static/img/span.png" width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail"> </a>
                <a href="链接bai的地址du"> <h4>Archery</h4> </a>
                <span class="text-muted">sql 审核查询平台</span>
            </div>
            <div class="col-xs-6 col-sm-3 placeholder">
                <a href="链接bai的地址du"> <img src="/static/img/span.png" width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail"> </a>
                <a href="链接bai的地址du"> <h4>占位</h4> </a>
                <span class="text-muted">占位</span>
            </div>
        </div>
        <h1 class="page-header"></h1>

        <div>
            <div class="table-responsive" >
                <form class="navbar-form navbar-left" action="/basic_app/instance_search"  role="search" method="post">
                    {#                <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"  aria-hidden="true" ></span><a href="/basic_app/user_add"> 添加用户</a></button>#}
                    <div class="form-group">
                        <input type="text" name="user_search" class="form-control" placeholder="Search">
                    </div>
                    <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search" aria-hidden="true"></span> 搜索</button>
                    <button type="button" class="btn btn-default" onclick="javascrtpt:window.location.href='/basic_app/instance_add'"><span class="glyphicon glyphicon-plus"  aria-hidden="true" ></span> 添加应用</button>
                </form>
                <table class="table table-striped table-bordered table-hover">
                    <thead>
                    <tr>
                        {#                    <th>+</th>#}
                        <th>应用名称</th>
                        <th>应用地址</th>
                        <th>图像</th>
                        <th>说明</th>
                        <th>备注</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {%   for i in instanceinfo_result %}
                        <tr>
                            {#                        <td><input type="checkbox"/></td>#}
                            <td style="display:none">{{ i.id }}</td>
                            <td>{{ i.hostname }}</td>
                            <td>{{ i.port }}</td>
                            <td>{{ i.sid }}</td>
                            <td>{{ i.port }}</td>
                            <td>{{ i.conn_string }}</td>
                            <td>{{ i.type }}</td>
                            <td>{{ i.status }}</td>
                            <td>{{ i.remake }}</td>
                            <td><a href="/basic_app/instance_edit?nid={{ i.id }}">编辑</a> | <a href="/basic_app/instance_delete?nid={{ i.id }}">删除</a> | <a href="/basic_app/instance_lock?nid={{ i.id }}">锁定</a> | <a href="/basic_app/instance_more?nid={{ i.id }}" >查看详情</a></td>
                        </tr>
                    {%  endfor %}
                    </tbody>
                </table>
            {#        以上是分页#}
 {% include 'basic_app/paginator.html' %}
{#        以下是分页#}
            </div>
        </div>
    </div>
{%  endblock  %}

{% block script %}
    <script>
        {#//onclick事件:获取下拉框的值，get方式发送到后台#}
        {#function aa_line(){#}
        {#    var line_count_set = $('.line_count').val();#}
        {#    var search = $('.aa_search').val();#}
            {#var   url="/basic_app/user?line_count="+line_count_set;#}
        {#    var   url="/basic_app/instance?line_count="+line_count_set+"&user_search="+search;#}
        {##}
        {#    window.location.href=url#}
        {#}#}
        //onclick事件:获取搜索框的值,get方式发送到后台
        function aa_search(){
            var search = $('.aa_search').val();
            var   url="/basic_app/instance?user_search="+search;
            window.location.href=url
        }

        //以下为页面刷新时自加载函数
        window.onload=function(){
            //刷新时,自动加载当前每页显示的条目数
            var count_set = document.getElementById("line_count").getAttribute("line_count");
            document.getElementById("line_count").value=count_set
            //刷新时,自动加载搜索框里的内容
            var search =  document.getElementById("aa_search").getAttribute("aa_search");

            $('.aa_search').val(search)
        }


    </script>

{% endblock %}